<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      div {
        border: 1px solid;
      }
    </style>
  </head>
  <body>
    <div id="box">hello <u>div</u></div>
    <script>
      const divEl = document.getElementById("box");
      console.log("innerHTML", divEl.innerHTML);
      console.log("outerHTML", divEl.outerHTML);

      setTimeout(() => {
        divEl.outerHTML = "<p><b>hi <i>jack</i></b></p>";
      }, 3000);
      console.log("outerHTML", divEl.outerHTML);
    </script>
  </body>
</html>
